#ifndef GAMEENGINE_GEOMETRY_COORDS2D_HPP
#define GAMEENGINE_GEOMETRY_COORDS2D_HPP

#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//=================================================================================
// Implementation of the Coords2d class

//! Default constructor
/*!
 @note Coordinates are defaulted to (0,0)
 */
template <class T>
Coords2d<T>::Coords2d() : u_(0), v_(0) {}

//! Constructor from two coordinates
/*!
 @param u The first coordinate
 @param v The second coordinate
 @note Type T should have a copy constructor
 */
template <class T>
Coords2d<T>::Coords2d(const T& u, const T& v) : u_(u), v_(v) {}

//! Copy constructor
/*!
 @param rhs The coordinates to copy
 @note Type T should have a copy constructor
 */
template <class T>
Coords2d<T>::Coords2d(const Coords2d& rhs) : u_(rhs.u_), v_(rhs.v_) {}

//! Destructor
template <class T>
Coords2d<T>::~Coords2d() {}

//! Assignment operator
/*!
 @param rhs The coordinates to copy
 @return A reference to these 2D coordinates
 @note Type T should have an assignment operator
 */
template <class T>
Coords2d<T>& Coords2d<T>::operator=(const Coords2d& rhs) {
	if ( &rhs != this ) {
		u_ = rhs.u_;
		v_ = rhs.v_;
	}
	return *this;
}

//! Accessor to the first coordinate (read only)
/*!
 @return A constant reference to the first coordinate
 */
template <class T>
const T& Coords2d<T>::u() const {
	return u_;
}

//! Accessor to the first coordinate (read-write)
/*!
 @return A reference to the first coordinate
 */
template <class T>
T& Coords2d<T>::u() {
	return u_;
}

//! Accessor to the second coordinate (read only)
/*!
 @return A constant reference to the second coordinate
 */
template <class T>
const T& Coords2d<T>::v() const {
	return v_;
}

//! Accessor to the second coordinate (read-write)
/*!
 @return A reference to the second coordinate
 */
template <class T>
T& Coords2d<T>::v() {
	return v_;
}

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
